//
//  Meeting_Detail_In_PersonCell.m
//  HuaRun2
//
//  Created by admin on 17/9/4.
//  Copyright © 2017年 Sunny. All rights reserved.
//

#import "Meeting_Detail_In_PersonCell.h"
#import "Meeting_Detail_InPerson.h"

@implementation Meeting_Detail_In_PersonCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)dealloc {
    NSLog(@"%@ dealloc", [self class]);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = RGBA(249, 249, 249, 1);
        
        [self viewInit];
        [self layoutInit];
    }
    return self;
}

- (void)viewInit {
    
    [super viewInit];
    [self.contentView addSubview:self.nameLab];
    [self.contentView addSubview:self.iconView];
    
}

- (void)layoutInit {
    [super layoutInit];
    
    weakself(ws);
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(ws.backView);
        make.left.mas_equalTo(ws.backView).offset(kMargin10);
        make.right.mas_equalTo(ws.iconView.mas_left).offset(-kMargin10);
    }];
    
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(ws.backView).offset(-kMargin10);
        make.size.mas_equalTo(CGSizeMake(15, 15));
        make.centerY.mas_equalTo(ws.backView);
    }];
}

#pragma mark - getter setter 
- (void)setInPersonModel:(Meeting_Detail_InPerson *)inPersonModel {
    _inPersonModel = inPersonModel;
    _nameLab.text = [NSString showSpaceStringWithStr:inPersonModel.name];
}

- (UIImageView *)iconView {
    if (!_iconView) {
        self.iconView = [UIImageView new];
        _iconView.image = [UIImage imageNamed:@"电话001"];
    }
    return _iconView;
}

- (UILabel *)nameLab {
    if (!_nameLab) {
        self.nameLab = [UILabel new];
        _nameLab.textAlignment = NSTextAlignmentLeft;
        _nameLab.font = kGeneralFontSize;
        _nameLab.textColor = [UIColor colorWithHex:@"3c3c3c"];
    }
    return _nameLab;
}

@end
